package xin.mashibo.pattern.observer;

import java.util.concurrent.TimeUnit;

/**
 * 图形数字观察者
 *
 * @author MaShibo
 * 日期 :  2019/1/28
 */
public class GraphObserver implements Observer {

    @Override
    public void update(NumberGenerator generator) {
        System.out.print("GraphObserver:");
        int count = generator.getNumber();
        for (int i = 0; i < count; i++) {
            System.out.print("*");
        }
        System.out.println("");
        try {
            TimeUnit.MILLISECONDS.sleep(100);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
